from toee import *

def OnBeginSpellCast( spell ):
	print "Web OnBeginSpellCast"
	print "spell.target_list=", spell.target_list
	print "spell.caster=", spell.caster, " caster.level= ", spell.caster_level
	game.particles( "sp-conjuration-conjure", spell.caster )

def OnSpellEffect( spell ):
	print "Web OnSpellEffect"

	spell.duration = 100 * spell.caster_level

	# spawn one Web scenery object
	web_obj = game.obj_create( OBJECT_SPELL_GENERIC, spell.target_loc )

	# add to d20initiative
	caster_init_value = spell.caster.get_initiative()
	web_obj.d20_status_init()
	web_obj.set_initiative( caster_init_value )

	# put sp-Web condition on obj
	Web_partsys_id = game.particles( 'sp-Web', web_obj )
	web_obj.condition_add_with_args( 'sp-Web', spell.id, spell.duration, 0, Web_partsys_id )
	#web_obj.condition_add_arg_x( 3, Web_partsys_id )
	#objectevent_id = web_obj.condition_get_arg_x( 2 )

def OnBeginRound( spell ):
	print "Web OnBeginRound"

def OnEndSpellCast( spell ):
	print "Web OnEndSpellCast"

def OnAreaOfEffectHit( spell ):
	print "Web OnAreaOfEffectHit"

def OnSpellStruck( spell ):
	print "Web OnSpellStruck"